﻿using MediatR;
using RBAC.MaHaiBo.API.Application.Command.TracingCommand;
using RBAC.MaHaiBo.Service.TraceabilityService;

namespace RBAC.MaHaiBo.API.Application.CommandHandlers.TracingHandler
{
    public class TracingDeleteCommandHandler : IRequestHandler<TracingDeleteCommand, int>
    {
        /// <summary>
        /// 溯源服务层
        /// </summary>
        ITracingService TSer;
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="TSer">溯源服务层</param>
        public TracingDeleteCommandHandler(ITracingService TSer)
        {
            this.TSer = TSer;
        }

        public async Task<int> Handle(TracingDeleteCommand request, CancellationToken cancellationToken)
        {
            return await TSer.DelTracing(request.Ids);
        }
    }
}
